gtksettings: unset attributes set to normal from font description
authorCosimo Cecchi <cosimoc@gnome.org>
Tue, 22 Mar 2011 18:51:06 +0000 (14:51 -0400)
committerCosimo Cecchi <cosimoc@gnome.org>
Wed, 23 Mar 2011 14:00:00 +0000 (10:00 -0400)
So that they do not override values coming from the theme.

Based on a patch by Carlos Garnacho.

https://bugzilla.gnome.org/show_bug.cgi?id=645458

gtk/gtksettings.c

index 3a834406b4a8c54e8975b827febb11edbf1e1b48..259960707c725b56939bfaac78aa25bc1b61f32a 100644 (file)
@@ -1345,6 +1345,24 @@ gtk_settings_get_style (GtkStyleProvider *provider,
 
   font_desc = pango_font_description_from_string (font_name);
 
+  /* Unset normal attributes from this description,
+   * so they do not override theme values */
+  if (pango_font_description_get_weight (font_desc) == PANGO_WEIGHT_NORMAL)
+    pango_font_description_unset_fields (font_desc,
+                                         PANGO_FONT_MASK_WEIGHT);
+
+  if (pango_font_description_get_stretch (font_desc) == PANGO_STRETCH_NORMAL)
+    pango_font_description_unset_fields (font_desc,
+                                         PANGO_FONT_MASK_STRETCH);
+
+  if (pango_font_description_get_variant (font_desc) == PANGO_VARIANT_NORMAL)
+    pango_font_description_unset_fields (font_desc,
+                                         PANGO_FONT_MASK_VARIANT);
+
+  if (pango_font_description_get_style (font_desc) == PANGO_STYLE_NORMAL)
+    pango_font_description_unset_fields (font_desc,
+                                         PANGO_FONT_MASK_STYLE);
+
   gtk_style_properties_set (props, 0,
                             "font", font_desc,
                             NULL);